package acm.蓝桥杯;

import java.util.*;

public class Main {
    static final int N = 1005;
    static List<Integer>[] G = new ArrayList[N];
    static List<Integer>[][] dp = new ArrayList[N][N];
    static double[][] f = new double[N][N];
    static double ans = 0;
    static int[] vis = new int[N];

    static class Node {
        int x, y;

        Node(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    static void bfs(int rt) {
        Arrays.fill(vis, 0);
        vis[rt] = 1;
        Queue<Node> q = new LinkedList<>();
        q.add(new Node(rt, 0));
        while (!q.isEmpty()) {
            Node p = q.poll();
            dp[rt][p.y].add(p.x);
            for (int it : G[p.x]) {
                if (vis[it] == 0) {
                    vis[it] = 1;
                    q.add(new Node(it, p.y + 1));
                }
            }
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int q = scanner.nextInt();
        for (int i = 1; i <= n; i++) {
            G[i] = new ArrayList<>();
            for (int j = 0; j <= n; j++) {
                dp[i][j] = new ArrayList<>();
            }
        }
        for (int i = 1; i <= m; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            G[x].add(y);
            G[y].add(x);
        }
        for (int i = 1; i <= n; i++) {
            Arrays.fill(vis, 0);
            vis[i] = 1;
            bfs(i);
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (j == 0) f[i][j] = dp[i][0].size();
                else f[i][j] = f[i][j - 1] + dp[i][j].size();
            }
        }
        for (int i = 1; i <= q; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            ans += f[x][y];
        }
        System.out.printf("%.2f", ans / q);
    }
}
